var presentationId = 0;
var autoScrollInterval = null;

function autoScroll() {
    if($("#playingInProgress").size() == 0) {
        stopPlay();
        return;
    }
    $.getJSON("/PresentationStatus?presentationId=" + presentationId + "&presentationProcess=" + $(document).scrollTop(),
        function (presentation) {
            if (presentation.owner == null) {
                $(document).scrollTop(presentation.process);
            }
        });
}

function stopPlay() {
    if (autoScrollInterval != null && autoScrollInterval != 0) {
        clearInterval(autoScrollInterval);
    }
    autoScrollInterval = null;
}


function startPlay() {
    autoScrollInterval = setInterval(autoScroll, 200);
}
